
# 1 定义装饰器
def print_info(get_sum):
    def fun_in():
        # 添加额外功能
        print('[友好提示]: 正在计算...')
        get_sum()
        pass

    return fun_in

# 2 原函数
@print_info    #   get_sum = print_info(get_sum)
def get_sum():
    a = 10
    b = 20
    c = a + b
    print('c-->', c)


# 3 调用函数
get_sum()

#
# # 1 定义装饰器
# def print_info(get_sum):
#     def fun_in(a, b):
#         # 添加额外功能
#         print('[友好提示]: 正在计算...')
#         get_sum(a, b)
#         pass
#
#     return fun_in
#
# # 2 原函数
# @print_info             #   get_sum = print_info(get_sum)
# def get_sum(a, b):
#     # a = 10
#     # b = 20
#     c = a + b
#     print('c-->', c)
#
#
# # 3 调用函数
# get_sum(10, 20)
